#ifndef unigame_TextAsset_h
#define unigame_TextAsset_h

#include <vector>
#include "config/Def.h"

namespace unigame
{
    class TextAsset
    {
    public:
        TextAsset(const char* name);
        ~TextAsset(){delete[] m_content;}
        
        uint16* getByIndex(int32 index);
        uint16* getByKey(const uint16* key);
        uint16* getByKey(const char* key);
        
        int32 getIndexLength()
        {
            return m_index.size();
        }
        
        int32 getKeyValueLength()
        {
            return m_index.size() / 2;
        }
        
    private:
        void init();
        
    private:
        uint16* m_content;
        int32 m_length;
        std::vector<int32> m_index;
    };
}

#endif
